package com.hzeport.bgs22emduty.enums;

import org.apache.commons.lang3.StringUtils;
import lombok.Getter;

/**
 * 值班类型字段 S_TYPE 枚举
 */
@Getter
public enum STypeEnum {
    TYPE_WB("1", "工作日班"),
    TYPE_ZMB("2", "节假日"),
    TYPE_ZYB("3", "重要日"),
    TYPE_ZM("4", "周末班");
    private final String code;
    private final String description;

    STypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String toString() {
        return this.getValue();
    }

    public String getValue() {
        return code;
    }

    public static String getDescByCode(String code) {
        if (StringUtils.isNotEmpty(code)) {
            for (STypeEnum myEnum : STypeEnum.values()) {
                if (StringUtils.equals(myEnum.getCode(), code)) {
                    return myEnum.getDescription();
                }
            }
        }
        return "";
    }

}
